#!/usr/bin/perl -w   # for syntax highlighting
package clreqd_modules;

#########################################################################
# This rountine takes NAME of the heartbeat network to stop using and	#
# communicates to the local heartbeat deamon and sends it that 		#
# message.								#
#									#
# Makes use of ::msg, ::warning and ::error when needbe.		#
#									#
#########################################################################

use Data::Dumper;
use Sys::Hostname;
use daemon_connect;

sub drop_disk_hb {
my %ARGS=@_;

	#################################################################
	# connect to the local heartbeat daemon and abort if not	#
	# running.							#
	#################################################################

	my $hb_daemon=new daemon_connect(host => hostname, daemon => "hbd", timeout => 5);
	if(!defined($hb_daemon)) {
		# no local heartbeat daemon - look for one elsewhere...
		return "ERROR No local heartbeat daemon running.";
	}
	my $r=$hb_daemon->send_request(ONEWAY=>0, MSG=>"STOPHB|$ARGS{NAME}");
	if(!defined($r)) {
		return "ERROR No response from local heartbeat daemon.";
	}
	if($r =~ /^CONNECT ERROR/) {
		return "ERROR No local heartbeat daemon.";
	}
	return $r;
}

1;
